import React, { Component } from "react";
import PropTypes from "prop-types";
import { Icon } from '@ali/ding-ui';

export default class Breadcrumb extends Component {
    constructor(props) {
        super(props);
    }
    render() {
        const navList = this.props.navList ? this.props.navList : [];
        const nav = navList.map((item, index) => {
            return (
                <span key={index} onClick={() => this.props.handleNavList(item.deptId, index)} className="crumb" >
                    {item.deptName && <span>{item.deptName}</span>}
                    {
                        (navList.length > 1 && index !== navList.length - 1) &&
                        <Icon type="right" size={28} />
                    }
                </span>
            )
        })
        return (
            <div className="breadcrumb">
                {nav}
            </div>
        );
    }
}
Breadcrumb.propTypes = {
    title: PropTypes.string,
    color: PropTypes.string,
};
